package com.example.java_blog.controller;

import com.example.java_blog.mapper.BlogInfoMapper;
import com.example.java_blog.mapper.UserInfoMapper;
import com.example.java_blog.model.Result;
import com.example.java_blog.model.UserInfo;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 均先生
 * Date: 2024-03-10
 * Time: 15:33
 */
@Slf4j
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserInfoMapper userInfoMapper;
    @ResponseBody
    @RequestMapping("/login")
    public Result login(@RequestParam String name, HttpServletRequest request) {
        log.info("Hello");
        UserInfo userInfo = userInfoMapper.selectByName(name);
        if (userInfo == null || userInfo.getUserName() != null) {
            log.info("请先注册");
        }
        return null;
    }
}
